using DG.Tweening;
using UnityEngine;
using QFramework;

// 1.请在菜单 编辑器扩展/Namespace Settings 里设置命名空间
// 2.命名空间更改后，生成代码之后，需要把逻辑代码文件（非 Designer）的命名空间手动更改
namespace Rpg.UI
{
	public partial class FlyText : ViewController
	{
		void Start()
		{
		}

		public void SetText(string text, Color color = default)
		{
			SelfTextMeshProUGUI.text = text;
			SelfTextMeshProUGUI.color = color;
			transform.localScale = Vector3.one;
			//x轴上随机向1和-1之间移动
			transform.DOLocalMoveX(RandomUtility.Choose(-5,-1, 5, 1), 0.5f).SetEase(Ease.OutBack);
			//transform.DOScale(Vector3.zero, 3f).SetEase(Ease.OutBack);
			transform.DOLocalMoveY(transform.localPosition.y + 1f, 0.5f)
				.SetEase(Ease.OutBack).OnComplete(() =>
				{
					transform.DOScale(Vector3.zero, 0.5f).SetEase(Ease.OutBack).OnComplete(() =>
					{
						PoolMgr.Instance.PushObj(gameObject);
					});
				});
		}
		
	}
}
